package datamodel

//ConfigParam 配置文件主结构
type ConfigParam struct {
	MqttServer *MqttServer         `json:"mqtt_server"`
	Clients    []*DirectClientPare `json:"clients"`
}

//MqttServer 为了JSON序列化
type MqttServer struct {
	Host     string `json:"host"`
	Port     uint16 `json:"port"`
	TopicTip string `json:"topic_tip"`
}

//DirectClientPare 直通模式，sender不为nil
type DirectClientPare struct {
	Name       string      `json:"name"`
	Receiver   *MqttClient `json:"mqtt_client"`
	Senders    *TCPClient  `json:"tcp_client"`
	DataDBMode string      `json:"dataDBMode"`
}

//MqttClient 数据来源
type MqttClient struct {
	Pub                string `json:"pub"`
	Sub                string `json:"sub"`
	UseTopicTip        bool   `json:"use_topic_tip"`
	AutoAddMachineName bool   `json:"auto_add_machine_name"`
}

//TCPClient 直通模式使用
type TCPClient struct {
	Host     string `json:"host"`
	Port     uint16 `json:"port"`
	Mode     string `json:"mode"`
	Protocol string `json:"protocol"`
}
